﻿<UserControl xmlns:controls="clr-namespace:System.Windows.Controls;assembly=System.Windows.Controls"  xmlns:controlsToolkit="clr-namespace:System.Windows.Controls;assembly=System.Windows.Controls.Toolkit" 
    x:Class="MapEditor.Page"
    xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" 
    xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
    xmlns:data="clr-namespace:System.Windows.Controls;assembly=System.Windows.Controls.Data"
    xmlns:this="clr-namespace:MapEditor">
    <!--xmlns:ComponentArt="clr-namespace:ComponentArt.Silverlight.UI.Navigation;assembly=ComponentArt.Silverlight.UI.Navigation"-->

    <Canvas Background="Black" x:Name="MainCanvas">
        
        <Rectangle x:Name="SelectionBox" Canvas.Top="8" Canvas.Left="-2" Width="20" Height="20" Stroke="White">
            
        </Rectangle>
            <Image Canvas.Left="0" Canvas.Top="10" Source="Images/Toolbar/Arrow.png" Width="16" Height="16" MouseLeftButtonDown="ImageSelect_MouseLeftButtonDown" ToolTipService.ToolTip="Select"/>
            
            <Image Canvas.Left="25" Canvas.Top="10" Source="Images/Toolbar/Draw.png" Width="16" Height="16" MouseLeftButtonDown="ImageDraw_MouseLeftButtonDown" ToolTipService.ToolTip="Draw"/>

            <Image Canvas.Left="50" Canvas.Top="10"  Source="Images/Toolbar/Dropper.png" Width="16" Height="16" MouseLeftButtonDown="ImageDropper_MouseLeftButtonDown" ToolTipService.ToolTip="Dropper"/>

            <Image Canvas.Left="75" Canvas.Top="10" Source="Images/Toolbar/Fill.png" Width="16" Height="16" MouseLeftButtonDown="ImageFill_MouseLeftButtonDown" ToolTipService.ToolTip="Fill"/>
            
            <Image Canvas.Left="100" Canvas.Top="10" Source="Images/Toolbar/Erase.png" Width="16" Height="16" MouseLeftButtonDown="ImageErase_MouseLeftButtonDown" ToolTipService.ToolTip="Eraser"/>
            
            <Image Canvas.Left="125" Canvas.Top="10" Source="Images/Toolbar/Grid.png" Width="16" Height="16" MouseLeftButtonDown="ImageGrid_MouseLeftButtonDown" ToolTipService.ToolTip="Toggle Grid"/>
        
            <Image Canvas.Left="150" Canvas.Top="10" Source="Images/Toolbar/Erase.png" Width="16" Height="16" MouseLeftButtonDown="ImageStopAllAnim_MouseLeftButtonDown" ToolTipService.ToolTip="Stop All Animation"/>

            <Image Canvas.Left="175" Canvas.Top="10" Source="Images/Toolbar/Arrow.png" Width="16" Height="16" MouseLeftButtonDown="ImageGameMode_MouseLeftButtonDown" ToolTipService.ToolTip="Game Mode"/>
           

        <!--<Button Canvas.Left="200" Width="64" Canvas.Top="8" Content="Save Map" Click="Button_Click_Save"></Button>
        <Button Canvas.Left="290" Width="64"  Canvas.Top="8" Content="Load Map" Click="Button_Click_Load"></Button> -->
         <Canvas Canvas.Left="450" Canvas.Top="8">
            <ComboBox x:Name="LayerPicker"  Width="75" Height="25" SelectionChanged="LayerPicker_SelectionChanged" ToolTipService.ToolTip="Select which layer you will place your tiles on" >
                <ComboBoxItem Content="Layer 1" IsSelected="True"></ComboBoxItem>
                <ComboBoxItem Content="Layer 2"></ComboBoxItem>
            </ComboBox>
        </Canvas>
      
        <Canvas Canvas.Left="525" Canvas.Top="8">
            <TextBlock x:Name="SliderValue" Canvas.Left="50" Canvas.Top="0" Foreground="White" FontFamily="Georgia" FontSize="12" TextWrapping="Wrap" VerticalAlignment="Center" HorizontalAlignment="Center" Text="{Binding Value, Mode=OneWay, ElementName=ScalePickerSlider}"/>
            <Slider x:Name="ScalePickerSlider" Height="15"  Canvas.Top="10" Width="100" Canvas.Left="0" ToolTipService.ToolTip="Scale the map" Minimum="1" Maximum="100" ValueChanged="ScalePickerSlider_ValueChanged" Value="100" LargeChange="10"  SmallChange="1">
                
            </Slider>
            <!--<ComboBox x:Name="ScalePicker"  Width="100" Height="25" SelectionChanged="ScalePicker_SelectionChanged"  ToolTipService.ToolTip="Scale the map" >
                <ComboBoxItem Content="All" Tag="0.0"></ComboBoxItem>
                <ComboBoxItem Content="10%" Tag="0.10"></ComboBoxItem>
                <ComboBoxItem Content="30%" Tag="0.30"></ComboBoxItem>
                <ComboBoxItem Content="50%" Tag="0.50"></ComboBoxItem>
                <ComboBoxItem Content="75%" Tag="0.75"></ComboBoxItem>
                <ComboBoxItem Content="100%" Tag="1.0" IsSelected="True"></ComboBoxItem>
            </ComboBox>-->
        </Canvas>

        <Image x:Name="Title" Source="images/title.png" Canvas.Left="650" Canvas.Top="2"></Image>
        <Image x:Name="TitleReflect" Source="images/title.png" Canvas.Left="650" Canvas.Top="40">
            <Image.RenderTransform>
                <ScaleTransform ScaleY="-1"></ScaleTransform>
            </Image.RenderTransform>
            <Image.OpacityMask>
                <LinearGradientBrush StartPoint="0.5,0" EndPoint="0.5,1">
                    <GradientStop Color="#00000000" Offset="0.0"/>
                    <GradientStop Color="#FFFFFFFF" Offset="1"/>
                </LinearGradientBrush>
            </Image.OpacityMask>
        </Image>

        <ScrollViewer x:Name="ToolbarScroller" Canvas.Top="34" Width="250" Height="800">
            <StackPanel Height="800">

                <controlsToolkit:Expander IsExpanded="True" Header="Object Templates" Foreground="White">
                    <controls:TreeView IsTabStop="True" SelectedItemChanged="TreeViewObjects_SelectedItemChanged" Canvas.Left="10" Width="220" Height="300" x:Name="TreeViewObjects"></controls:TreeView>
                </controlsToolkit:Expander>

                <controlsToolkit:Expander  IsExpanded="False" Header="Opacity Masks" Foreground="White" >
                    <controls:TreeView IsTabStop="True" SelectedItemChanged="OpacityMaskTreeView_SelectedItemChanged" x:Name="OpacityMaskTreeView"  Canvas.Left="10" Width="220" Height="300"></controls:TreeView>
                </controlsToolkit:Expander>

                <controlsToolkit:Expander  IsExpanded="True" Header="Properties" Foreground="White" >
                    <controls:TreeView IsTabStop="True" x:Name="PropertiesTreeView"  Canvas.Left="10" Width="220" Height="300"></controls:TreeView>
                </controlsToolkit:Expander>

                <controlsToolkit:Expander IsExpanded="True" Header="Preview" Foreground="White" >
                    <Canvas x:Name="PreviewCanvas">
                        <Border CornerRadius="20" Canvas.Left="20" Width="190" Height="140" Background="White"></Border>
                    </Canvas>
                </controlsToolkit:Expander>

            </StackPanel>
        </ScrollViewer>

        <Canvas x:Name="MapArea" Canvas.Top="34" Canvas.Left="250" MouseMove="MapArea_MouseMove">
            <ScrollViewer x:Name="MapScroller" Width="600" Height="570" HorizontalScrollBarVisibility="Visible">
                <Canvas x:Name="MapCanvas" MouseLeftButtonUp="MapCanvas_MouseLeftButtonUp" MouseLeftButtonDown="MapCanvas_MouseLeftButtonDown" MouseEnter="Canvas_MouseEnter" MouseLeave="Canvas_MouseLeave">
                    <Canvas.RenderTransform>
                        <ScaleTransform x:Name="MacScale"></ScaleTransform>
                    </Canvas.RenderTransform>
                </Canvas>
            </ScrollViewer>
            
        </Canvas>
        <StackPanel x:Name="StackMenu" HorizontalAlignment="Left" VerticalAlignment="Top" Width="150"  Canvas.ZIndex="3" Visibility="Collapsed">
            <StackPanel.Effect>
                <DropShadowEffect/>
            </StackPanel.Effect>
            <Button x:Name="mnuNewMap" Style="{StaticResource MenuStyleButton}" Content="New Map" Click="mnuNewMap_Click"/>
            <Button x:Name="mnuOpenMap" Style="{StaticResource MenuStyleButton}" Content="Open Map" Click="mnuOpenMap_Click"/>
            <Button x:Name="mnuSaveMap" Style="{StaticResource MenuStyleButton}" Content="Save Map" Click="mnuSaveMap_Click"/>
        </StackPanel>


    </Canvas>
</UserControl>

    